{% extends "base.html" %}

{% block title5 %}
    active
{% endblock %}

{% block page-body %}
    <h1 class="page-header">数据修改</h1>

    <!--面板 开始-->
    <div class="panel panel-primary">
        <div class="panel-heading">软件加固信息修改</div>
        <div class="panel-body">
            <form class="form-inline" action="/edit_myworksoftware/?myworkandsoftware_id={{ myworkandsoftware_id }}" method="post">
                {% csrf_token %}

                <div class="form-group">
                    <label for="ip">IP</label>
                    <input name="ip" type="text" class="form-control" id="ip" value="{{ mysw.ip }}">
                </div>

                <div class="form-group">
                    <label for="date">加固日期</label>
                    <input name="date" type="date" class="form-control" id="date" value="{{ mysw.date.isoformat }}">
                </div>
                <div class="form-group"><strong>选择系统版本</strong>
                    <select name="os" class="form-control">

                        {% for i in os %}
                            {% if mysw.os_id == i.id %}
                                <option selected value="{{ mysw.os_id }}">{{ mysw.os.os }}</option>
                            {% else %}
                                <option value="{{ i.id }}">{{ i.os }}</option>
                            {% endif %}
                        {% endfor %}
                    </select>
                </div>
                <div class="form-group "><strong>选择软件版本</strong>
                    <select name="software_id" class="form-control">
                        {% for sw in sws %}
                            {% if obj.software_id == sw.id %}
                                <!---->
                                <option selected value="{{ obj.software_id }}">{{ obj.software.software }}</option>
                            {% else %}
                                <option selected value="{{ sw.id }}">{{ sw.software }}</option>
                            {% endif %}
                        {% endfor %}
                    </select>
                </div>

                <button type="submit" class="btn btn-success">提交</button>
            </form>
        </div>
        <!--面板body 结束-->
    </div>
{% endblock %}

{#<script language="JavaScript">#}
{#         // 给input  date设置默认值#}
{#    var now = new Date();#}
{#    //格式化日，如果小于9，前面补0#}
{#    var day = ("0" + now.getDate()).slice(-2);#}
{#    //格式化月，如果小于9，前面补0#}
{#    var month = ("0" + (now.getMonth() + 1)).slice(-2);#}
{#    //拼装完整日期格式#}
{#    var today = now.getFullYear()+"-"+(month)+"-"+(day) ;#}
{#    //完成赋值#}
{#    $('#date').val(today);#}
{##}
{#</script>#}

</body>
</html>